package com.luoying.itew.receiver;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.luoying.itew.util.LogUtils;
import com.luoying.itew.util.ZXWUtils;

import cn.jpush.android.api.JPushInterface;

/**
 * Created by Administrator on 2019/1/14.
 * time 2018-5-10
 * author zm
 * @deprecated
 * 这个暂时用不到
 */
public class AnTaiJpushReceiver extends BroadcastReceiver {
    private static final String TAG = "AnTaiJpushReceiver";
    private NotificationManager nm;
    private Notification notification;

    @Override
    public void onReceive(Context context, Intent intent) {
        if (null == nm) {
            nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        }

        Bundle bundle = intent.getExtras();

        if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
            LogUtils.d(TAG, "JPush 用户注册成功");

        } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
            LogUtils.d(TAG, "接受到推送下来的自定义消息");

        } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
            LogUtils.d(TAG, "接受到推送下来的通知");


        } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
            LogUtils.d(TAG, "用户点击打开了通知");
            ZXWUtils.doStartApplicationWithPackageName(context,"com.luoying.itew");

        } else {
            LogUtils.d(TAG, "Unhandled intent - " + intent.getAction());
        }
       /* Bundle bundle = intent.getExtras();
        String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
        String title = bundle.getString(JPushInterface.EXTRA_TITLE);
        String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
        LogUtils.d(TAG,"极光消息 message == " + message + ",title == " + title + ",extras == " + extras);*/

    }


}
